package gdma.hqdes.webapp.util;

import net.sourceforge.pinyin4j.PinyinHelper;

/**
 * @Author wangyue
 * @Version 3.0
 * @Date 2024-09-03
 */
public class PinyinUtils {

    public static String getPinyinHeads(String chineseString) {
        StringBuilder s = new StringBuilder();
        for (char c : chineseString.toCharArray()) {
            String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c);
            if (pinyinArray != null) {
                s.append(pinyinArray[0].charAt(0));
            }
        }
        return s.toString();
    }

}
